﻿/// <reference path="jquery-1.7-vsdoc.js" />


(function ($) {
    var method = {
        getOneByName: function (url, name) {
            var urlEscape = unescape(url);
            var strExp = "[?&#]&*" + name + "=([\\w\\s-]+)[&]"
            var urlExp = new RegExp(strExp, "gim");
            var result = urlExp.exec(urlEscape);
            return result[1];
        },
        getAllReturnObject: function (url) {
            var urlEscape = unescape(url);
            var strExp = "[\\?&#]&*(\\w+)=([\\w\\s-]+)"
            var urlExp = new RegExp(strExp, "gim");
            var object = new Object();
            var result;
            result = urlExp.exec(urlEscape);
            while (result != null) {
                object[result[1]] = result[2];
                result = urlExp.exec(urlEscape)
            }
            return object;
        },
        getNowUrlOneByName: function (name) {
            return this.UrlParam("getOneByName", location.href, name);
        },
        getNowUrlReturnObject: function () {

            return this.UrlParam("getAllReturnObject", location.href);

        }

    };

    $.fn.UrlParam = function (methodName) {
        if (method[methodName]) {
            return method[methodName].apply(this, Array.prototype.slice.call(arguments, 1));
        }


    };
})(jQuery);